<script>
	import {
		getriders
	} from '@/api/all.js';
	import store from './store';
	import {
		Login
	} from '@/api/http.js'
	//引入websocket文件
	import wsRequest from '@/api/websocket.js'
	export default {
		onLaunch() {
			wx.updateShareMenu({
				title: 'Sinchay点餐',
				path: '/pages/main/main',
				imageUrl: ''
			})
			wx.showShareMenu({
				withShareTicket: true
			})

			if (!store.getters.gettoken) {
				Login();
			}
			if (store.state.shoptoken) {
				//开启websocket
				let websocket = new wsRequest("wss://restaurant.dikidiki.cn/wss", 55000)
				let data = {
					'token': uni.getStorageSync('shoptoken')
				}
				websocket.send(JSON.stringify(data));
			}
		},
		computed: {
			shopToken() {
				return this.$store.state.shoptoken;
			}
		},
		watch: {
			shopToken(newName, oldName) {
				//开启websocket
				let websocket = new wsRequest("wss://restaurant.dikidiki.cn/wss", 55000)
				let data = {
					'token': uni.getStorageSync('shoptoken')
				}
				websocket.send(JSON.stringify(data));
			},
		},
		onShow() {

		},
		onHide() {

		},

	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	@import '@/static/css/font.css';
	page {
		background-color: $uni-bg-color;
		font-size: $uni-font-size-base;

		.ug-from {
			direction: rtl !important;
			font-family: UKIJTuzTom !important;

			input {
				text-align: right !important;
				font-family: UKIJTuzTom !important;
			}

			.u-input__content__field-wrapper__field {
				text-align: right !important;
				font-family: UKIJTuzTom !important;
			}

			.input-placeholder {
				font-family: UKIJTuzTom !important;
			}

			/deep/ .uni-input-input {
				direction: rtl !important;
				text-align: right;
			}

			/deep/ .uni-input-placeholder {
				text-align: right !important;
				font-family: UKIJTuzTom !important;
			}
		}
	}
</style>